package com.session01;

import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        System.out.println(findString(str));
    }

    public static int findString(String str) {
        int num = 0;
        char[] chars = str.toCharArray();
        for (int i = 0; i < chars.length - 1; i++) {
            if (chars[i] == 'a' && chars[i + 1] == 'f') {
                num++;
                //可以减少比较次数，后面如果是f，就跳过
                i++;
            }
        }
        return num;
    }
}
